import 'package:sexy_tea/model/home_grid_model.dart';

homeGridModelFromJson(HomeGridModel data, Map<String, dynamic> json) {
	if (json['data'] != null) {
		data.data = new List<HomeGridData>();
		(json['data'] as List).forEach((v) {
			data.data.add(new HomeGridData().fromJson(v));
		});
	}
	if (json['code'] != null) {
		data.code = json['code'] is String
				? int.tryParse(json['code'])
				: json['code'].toInt();
	}
	if (json['msg'] != null) {
		data.msg = json['msg'].toString();
	}
	return data;
}

Map<String, dynamic> homeGridModelToJson(HomeGridModel entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	if (entity.data != null) {
		data['data'] =  entity.data.map((v) => v.toJson()).toList();
	}
	data['code'] = entity.code;
	data['msg'] = entity.msg;
	return data;
}

homeGridDataFromJson(HomeGridData data, Map<String, dynamic> json) {
	if (json['title'] != null) {
		data.title = json['title'].toString();
	}
	if (json['subTitle'] != null) {
		data.subTitle = json['subTitle'].toString();
	}
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['imgName'] != null) {
		data.imgName = json['imgName'];
	}
	if (json['position'] != null) {
		data.position = json['position'];
	}
	if (json['sort'] != null) {
		data.sort = json['sort'] is String
				? int.tryParse(json['sort'])
				: json['sort'].toInt();
	}
	if (json['status'] != null) {
		data.status = json['status'] is String
				? int.tryParse(json['status'])
				: json['status'].toInt();
	}
	if (json['upperRackTime'] != null) {
		data.upperRackTime = json['upperRackTime'].toString();
	}
	if (json['underRackTime'] != null) {
		data.underRackTime = json['underRackTime'].toString();
	}
	if (json['createBy'] != null) {
		data.createBy = json['createBy'] is String
				? int.tryParse(json['createBy'])
				: json['createBy'].toInt();
	}
	if (json['createTime'] != null) {
		data.createTime = json['createTime'].toString();
	}
	if (json['updateBy'] != null) {
		data.updateBy = json['updateBy'] is String
				? int.tryParse(json['updateBy'])
				: json['updateBy'].toInt();
	}
	if (json['updateTime'] != null) {
		data.updateTime = json['updateTime'].toString();
	}
	if (json['img'] != null) {
		data.img = json['img'].toString();
	}
	if (json['skipType'] != null) {
		data.skipType = json['skipType'].toString();
	}
	if (json['skipId'] != null) {
		data.skipId = json['skipId'] is String
				? int.tryParse(json['skipId'])
				: json['skipId'].toInt();
	}
	if (json['skipUrl'] != null) {
		data.skipUrl = json['skipUrl'].toString();
	}
	if (json['skipOrigin'] != null) {
		data.skipOrigin = json['skipOrigin'];
	}
	return data;
}

Map<String, dynamic> homeGridDataToJson(HomeGridData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['title'] = entity.title;
	data['subTitle'] = entity.subTitle;
	data['id'] = entity.id;
	data['imgName'] = entity.imgName;
	data['position'] = entity.position;
	data['sort'] = entity.sort;
	data['status'] = entity.status;
	data['upperRackTime'] = entity.upperRackTime;
	data['underRackTime'] = entity.underRackTime;
	data['createBy'] = entity.createBy;
	data['createTime'] = entity.createTime;
	data['updateBy'] = entity.updateBy;
	data['updateTime'] = entity.updateTime;
	data['img'] = entity.img;
	data['skipType'] = entity.skipType;
	data['skipId'] = entity.skipId;
	data['skipUrl'] = entity.skipUrl;
	data['skipOrigin'] = entity.skipOrigin;
	return data;
}